import time

from zuoye_831.Page import Page
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

class Page2(Page):
    search_loc = (By.ID,'wd')
    def search(self):
        self.send_keys(self.search_loc,'五粮液')
        self.send_keys(self.search_loc,Keys.ENTER)

    img_loc = (By.XPATH,'/html/body/div[6]/div/div[2]/div[5]/ul/li[1]/div[2]/div[1]/a/img')
    def img(self):
        self.click(self.img_loc)

    buycar_loc = (By.XPATH,'//*[@id="addToCartForDetail"]')
    def buycar(self):
        self.click(self.buycar_loc)

    def jiuxian_02(self):
        self.jiuxian_01()
        self.search()
        time.sleep(2)
        self.img()
        time.sleep(1)
        self.window()
        time.sleep(1)
        self.buycar()
        time.sleep(3)